package com.aaa.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

@Data
public class Leadingusers implements UserDetails {
    private Integer lid;

    /**
    * 姓名
    */
    private String lname;

    /**
    * 账号
    */
    private String username;

    @TableField(exist = false)
    private String dispayName;
    /**
     * 密码
     */
    private String password;

    /**
    * 头像
    */
    private String lhead;

    /**
    * 性别
    */
    private String lsex;

    private String vip;
    private String daoqiTime;

    /**
    * 地址
    */
    private String address;


    /**
     * 创建时间
     */
    private String createDate;
    /**
     * 邮箱
     */
    private String lemail;

    /**
    * 用户的禁用启用
    */
    private String state;

    /**
     * 验证码用来接收用户传来的参数
     */
    @TableField(exist = false)
    private String code;
    @TableField(exist = false)
    private List<GrantedAuthority> authorities = new ArrayList<>();

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return authorities;
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }
}